package com.laamella.syntherface.synths.alesis.micron.gui;

import com.laamella.syntherface.synths.alesis.micron.model.Oscillator;

@SuppressWarnings("serial") public class OscillatorPanel extends javax.swing.JPanel {

	/** Creates new form OscillatorPanel */
	public OscillatorPanel() {
		initComponents();
	}

	public void setModel(Oscillator oscillator) {
		titleLabel.setText("Oscillator "+oscillator.number);
		waveformButtonGroup.setModel(oscillator.waveform);
		shapeSlider.setModel(oscillator.waveShape);
		pitchSlider.setModel(oscillator.pitch);
		octaveSlider.setModel(oscillator.octave);
		transposeSlider.setModel(oscillator.transpose);
	}

	/**
	 * This method is called from within the constructor to initialize the
	 * form. WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")// <editor-fold defaultstate="collapsed"
					// desc="Generated
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        waveformButtonGroup = new com.laamella.syntherface.synths.gui.RotaryButtonGroup();
        javax.swing.JPanel jPanel1 = new javax.swing.JPanel();
        javax.swing.JLabel jLabel2 = new javax.swing.JLabel();
        transposeSlider = new javax.swing.JSlider();
        javax.swing.JLabel jLabel3 = new javax.swing.JLabel();
        pitchSlider = new javax.swing.JSlider();
        javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
        octaveSlider = new javax.swing.JSlider();
        javax.swing.JPanel jPanel2 = new javax.swing.JPanel();
        shapeSlider = new javax.swing.JSlider();
        sineButton = new javax.swing.JRadioButton();
        sawButton = new javax.swing.JRadioButton();
        squareButton = new javax.swing.JRadioButton();
        titleLabel = new javax.swing.JLabel();

        setBackground(new java.awt.Color(153, 255, 153));
        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 3));
        setLayout(null);

        jPanel1.setOpaque(false);
        jPanel1.setLayout(null);

        jLabel2.setLabelFor(transposeSlider);
        jLabel2.setText("transp");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(30, 10, 50, 14);

        transposeSlider.setOrientation(javax.swing.JSlider.VERTICAL);
        transposeSlider.setOpaque(false);
        jPanel1.add(transposeSlider);
        transposeSlider.setBounds(30, 20, 24, 60);

        jLabel3.setLabelFor(pitchSlider);
        jLabel3.setText("pitch");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(60, 0, 30, 14);

        pitchSlider.setOrientation(javax.swing.JSlider.VERTICAL);
        pitchSlider.setOpaque(false);
        jPanel1.add(pitchSlider);
        pitchSlider.setBounds(60, 10, 20, 70);

        jLabel1.setLabelFor(octaveSlider);
        jLabel1.setText("octave");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(0, 0, 60, 14);

        octaveSlider.setOrientation(javax.swing.JSlider.VERTICAL);
        octaveSlider.setOpaque(false);
        jPanel1.add(octaveSlider);
        octaveSlider.setBounds(0, 10, 24, 70);

        add(jPanel1);
        jPanel1.setBounds(100, 30, 170, 140);

        jPanel2.setOpaque(false);
        jPanel2.setLayout(null);

        shapeSlider.setOpaque(false);
        jPanel2.add(shapeSlider);
        shapeSlider.setBounds(0, 60, 80, 20);

        waveformButtonGroup.add(sineButton);
        sineButton.setSelected(true);
        sineButton.setText("Sine");
        sineButton.setName("sineWave"); // NOI18N
        sineButton.setOpaque(false);
        sineButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sineButtonActionPerformed(evt);
            }
        });
        jPanel2.add(sineButton);
        sineButton.setBounds(0, 0, 90, 23);

        waveformButtonGroup.add(sawButton);
        sawButton.setText("Saw/Triangle");
        sawButton.setName("sineWave"); // NOI18N
        sawButton.setOpaque(false);
        sawButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sawButtonActionPerformed(evt);
            }
        });
        jPanel2.add(sawButton);
        sawButton.setBounds(0, 20, 90, 23);

        waveformButtonGroup.add(squareButton);
        squareButton.setText("Square");
        squareButton.setName("squareWave"); // NOI18N
        squareButton.setOpaque(false);
        jPanel2.add(squareButton);
        squareButton.setBounds(0, 40, 90, 23);

        add(jPanel2);
        jPanel2.setBounds(10, 30, 90, 80);

        titleLabel.setFont(new java.awt.Font("Tahoma", 1, 18));
        titleLabel.setText("Oscillator");
        add(titleLabel);
        titleLabel.setBounds(10, 10, 130, 20);
    }// </editor-fold>//GEN-END:initComponents

	private void sineButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_sineButtonActionPerformed
	// TODO add your handling code here:
	}// GEN-LAST:event_sineButtonActionPerformed

	private void sawButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_sawButtonActionPerformed
	// TODO add your handling code here:
	}// GEN-LAST:event_sawButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JSlider octaveSlider;
    private javax.swing.JSlider pitchSlider;
    private javax.swing.JRadioButton sawButton;
    private javax.swing.JSlider shapeSlider;
    private javax.swing.JRadioButton sineButton;
    private javax.swing.JRadioButton squareButton;
    private javax.swing.JLabel titleLabel;
    private javax.swing.JSlider transposeSlider;
    private com.laamella.syntherface.synths.gui.RotaryButtonGroup waveformButtonGroup;
    // End of variables declaration//GEN-END:variables

}
